<?php
/**
 * This is the FireFeed Loginffadmin form.
 * 
 * @uses       Zend_Form
 * @package    FireFeed
 * @subpackage Form
 */
class Form_Loginffadmin extends Zend_Form
{
	/**
     * init() routine called when Zend_Form objects are created.
     * It make sense to define form elements in this method.
     * 
     * @see    http://framework.zend.com/manual/en/zend.form.html
     * @return void
     */ 
	public function init()
    {
    	$this->setAction('/admin/login');
    	$this->setMethod('POST');
        
    	$this->setElementFilters(array('StringTrim'));
    	
    	$this->setAttrib('class', 'formstyle');
    	$this->setAttrib('id', 'loginffadminForm');

    	    	
        // Add Username element
        $username = new Zend_Form_Element_Text('username');
        $username->setLabel('username')
	        	 ->setAttrib('class', 'fieldffadmin')
    	         ->setRequired(true)
    	         ->setDecorators(array(
    	           array('ViewHelper', array('helper'=>'formText')),
    	           array('Label', array('class'=>'gray labelffadmin')),
    	           array('Errors', array('tag' => 'span'))
    	));
    	         
        // Add a password element
    	$password = new Zend_Form_Element_Password('password');
        $password->setLabel('Password:')
        		 ->setAttrib('class', 'fieldffadmin')
        		 ->setRequired(true)
                 ->setValidators(array('alnum'))
                 ->setDecorators(array(
                   array('ViewHelper', array('helper'=>'formPassword')),
                   array('Label', array('class'=>'grey labelffadmin')),
                   array('Errors', array('tag' => 'span'))
        ));
    	
        // Add a submit button
        $submit = new Zend_Form_Element_Submit('Login');
        $submit->setAttrib('class', 'ffadmin_submit')
               ->setDecorators(array(
                   array('ViewHelper', array('helper'=>'formSubmit'))
        ));
        
        $this->addElements(array(
            $username,
            $password,
            $submit
        ));
        
        $this->setDecorators(array(
            'FormElements',
            'Form'
        ));
    }
    
}
